package cn.chengpengper.rpc.proxy.api.config;

import cn.chengpengper.rpc.proxy.api.consumer.Consumer;
import cn.chengpengper.rpc.registry.api.RegistryService;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author chengpeng.hu
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProxyConfig<T> implements Serializable {

    private static final long serialVersionUID = 6648940252795742398L;

    private Class<T> clazz;

    private String serviceVersion;

    private String serviceGroup;

    private long timeout;

    private Consumer consumer;

    private String serializationType;

    private boolean async;

    private boolean oneway;

    private RegistryService registryService;

    private boolean enableResultCache;

    private int resultCacheExpire;

    public ProxyConfig(Class<T> clazz,
                       String serviceVersion,
                       String serviceGroup,
                       String serializationType,
                       long timeout,
                       RegistryService registryService,
                       Consumer consumer,
                       boolean async,
                       boolean oneway,
                       boolean enableResultCache,
                       int resultCacheExpire
                       ) {
        this.clazz = clazz;
        this.serviceVersion = serviceVersion;
        this.serviceGroup = serviceGroup;
        this.timeout = timeout;
        this.consumer = consumer;
        this.serializationType = serializationType;
        this.async = async;
        this.oneway = oneway;
        this.registryService = registryService;
        this.enableResultCache = enableResultCache;
        this.resultCacheExpire = resultCacheExpire;
    }

}
